package composite;

import lombok.Data;

/**
 * @program: DesignModeProject
 * @description:
 * @author: Li canzhang
 * @create: 2022-05-29 21:31
 **/
@Data
public abstract class OrganizationComponent {
    private String name;//名字
    private String des;//说明

    protected void add(OrganizationComponent organizationComponent){
        //由于叶子节点不需要去实现 add方法,所以在抽象的父类方法中我们写个默认实现
        throw new UnsupportedOperationException();
    }

    protected void remove(OrganizationComponent organizationComponent){
        //由于叶子节点不需要去实现remove方法,所以在抽象的父类方法中我们写个默认实现
        throw new UnsupportedOperationException();
    }

    public OrganizationComponent(String name, String des) {
        this.name = name;
        this.des = des;
    }

    protected abstract void print();
}
